<template>
  <div>
    <button @click="addNum(10)">+</button>
    <button @click="addNumAsync">异步调用</button>
    {{ num }}
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
export default {
  /* methods: {
    addNum () {
      this.$store.commit('addNum', 5)
    }
  }, */
  methods: {
    ...mapMutations(['addNum']),
    ...mapActions(['addNumAsync'])
  },
  computed: {
    ...mapState(['num'])
  }
  /* computed: {
    num () {
      return this.$store.state.num
    }
  } */
}
</script>

<style lang="scss" scoped>

</style>
